//
//  HTTPManager.h
//  DDSocial
//
//  Created by 阿帕 on 2018/8/25.
//  Copyright © 2018年 XY. All rights reserved.
//

#import <Foundation/Foundation.h>

typedef void(^ArrayResultBlock)(NSInteger code, NSString *msg, NSArray *result);

typedef void(^DictionaryResultBlock)(NSInteger code, NSString *msg, NSDictionary *result);

typedef void(^StringResultBlock)(NSInteger code, NSString *msg, NSString *result);

typedef void(^ResponseSuccess)(id response, NSString *msg);

typedef void(^ResponseFailed)(NSInteger code, NSString *msg);

@interface HTTPManager : NSObject

/**
 * 方式 POST
 * 参数 NSDictionary
 * 请求接口名称 方便查看打印数据
 */
+ (void)postNetworkRequest:(NSString *)urlString withParameter:(NSDictionary *)parameter withVC:(UIViewController *)vc netName:(NSString *)netName success:(ResponseSuccess)success failure:(ResponseFailed)failure;

/**
 * 方式 GET
 * 参数 NSDictionary
 * 请求接口名称 方便查看打印数据
 */
+ (void)getNetworkRequest:(NSString *)urlString withParameter:(NSDictionary *)parameter withVC:(UIViewController *)vc netName:(NSString *)netName success:(ResponseSuccess)success failure:(ResponseFailed)failure;

/**
 * 方式 DELETE
 * 参数 NSDictionary
 * 请求接口名称 方便查看打印数据
 */
+ (void)deleteNetworkRequest:(NSString *)urlString withParameter:(NSDictionary *)parameter withVC:(UIViewController *)vc netName:(NSString *)netName success:(ResponseSuccess)success failure:(ResponseFailed)failure;

/**
 * 方式 PUT
 * 参数 NSDictionary
 * 请求接口名称 方便查看打印数据
 */
+ (void)putNetworkRequest:(NSString *)urlString withParameter:(NSDictionary *)parameter withVC:(UIViewController *)vc netName:(NSString *)netName success:(ResponseSuccess)success failure:(ResponseFailed)failure;


/**
 * 文件上传
 * 方式 POST
 * 参数 file
 * 请求接口名称 方便查看打印数据
 */
+ (void)postUploadFiles:(NSString *)urlString file:(NSArray *)fileArray fileName:(NSString *)fileName withVC:(UIViewController *)vc netName:(NSString *)netName success:(ResponseSuccess)success failure:(ResponseFailed)failure;

/**
 * 方式 GET
 * 获取图片验证码单独的请求
 *
 */
+ (void)getImageVerCodeRequest:(NSString *)urlString withParameter:(NSDictionary *)parameter withVC:(UIViewController *)vc netName:(NSString *)netName success:(ResponseSuccess)success failure:(ResponseFailed)failure;

/// json传参
/// @param method @”POST“ @”GET“
/// @param urlString url
/// @param parameter 参数
/// @param vc 控制器
/// @param netName 名称
/// @param success 成功
/// @param failure 失败
+ (void)jsonNetworkRequestWithMethod:(NSString * _Nonnull)method urlString:(NSString * _Nonnull)urlString withParameter:(id _Nullable)parameter withVC:(UIViewController * _Nullable)vc netName:(NSString * _Nullable)netName success:(ResponseSuccess _Nonnull)success failure:(ResponseFailed _Nonnull)failure;


#pragma mark - 网络连接错误码处理
+ (void)networkResponseErrorCodeDispose:(NSError * _Nonnull)error andNetName:(NSString *_Nullable)netName andShowView:(UIViewController *_Nullable)vc;

/**
 根据银行卡号判断卡类型支付宝API
 https://ccdcapi.alipay.com/validateAndCacheCardInfo.json?_input_charset=utf-8&cardBinCheck=true&cardNo=%@
 */


@end
